import {JsonController,Controller, Render, Get, UseBefore, Session,Req,Res,Ctx,QueryParams,UseInterceptor,Post,Body} from "routing-controllers";
import { config } from "../../config";
import { Service, Inject } from "typedi";
import {CountryServiceImpl} from '../../service/impl/CountryServiceImpl'
import {getTimeModel,getThinkModel} from '../../model/CountryModel'
import TokenLoginMiddlewares from '../../middleware/TokenLoginMiddlewares';
import { JsonResponseInterceptor } from "../../middleware/JsonResponseMiddlewares";

@Service()
@JsonController(`${config.apiurl}/v1/country`)
@UseInterceptor(JsonResponseInterceptor)
@UseBefore(TokenLoginMiddlewares)
export class CountryControerApi {



    @Inject()
    private CountryServiceImpl!:CountryServiceImpl;


    @Get("/getAllCountry")
    public async getAllCountry (@Res() response: any,@Session() session:any,): Promise<any> {
        return await this.CountryServiceImpl.getAllCountry();
    }


    @Get("/getAllTime")
    public async getAllTime (@Res() response: any,@Session() session:any,@QueryParams() params:getTimeModel): Promise<any> {

        return await this.CountryServiceImpl.getAllTime(params.country_Id);
    }

    @Get("/getAllThink")
    public async getAllThink (@Res() response: any,@Session() session:any,@QueryParams() params:getThinkModel): Promise<any> {

        return await this.CountryServiceImpl.getAllThink(params.country_Id,params.think_Page,params.think_Count,params.time_Id);
    }

  }